﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<link href="${ctx.resource}/css/component/coverupload.css" rel="stylesheet">

<div class="modal-dialog x-modal-dialog" style="width:600px; margin-top: 150px;">

  <div class="modal-content">

    <div class="modal-header x-breadcrumb no-bottom-border clearfix">

      <h2><i class="glyphicon glyphicon-fire"></i>&nbsp;&nbsp;<span>修改动作</span></h2>

      <button type="button" class="close" data-dismiss="modal">&times;</button>

    </div>

    <form class="form-horizontal" method="POST" action="${ctx.host}/online-rounds/${roundCode}/rounds/${roundId}/batch-coursewares/${weeks}/daily-coursewares/${dailyCoursewareId}/coursewares/${courseware.id}" data-validate="true">
      
      <input type="hidden" name="_method" value="PATCH">
      <input type="hidden" name="coursewareId" value="${courseware.id}">
      
      <div class="modal-body">
        <div class="form-group x-form-group">
          <label class="col-xs-3 control-label">动作</label>
          <div class="pull-left col-xs-7">
            <select name="movement" class="form-control select2" data-validate="required">
              <option></option>
              <c:forEach var="movement" items="${persist.movements}">
                <c:if test="${not movement.disabled}">
                  <option value="${movement.id}" ${movement.id == courseware.movement.id ? 'selected' : ''}>${movement.name}</option>
                </c:if>
              </c:forEach>
            </select>
          </div>
        </div>
        <div class="form-group x-form-group">
          <label class="col-xs-3 control-label">组数</label>
          <div class="pull-left col-xs-7">
            <input type="text" name="groupAmount" value="${courseware.groupAmount}" class="form-control" placeholder="请输入组数" data-validate="required|number">
          </div>
        </div>
        <div class="form-group x-form-group">
          <label class="col-xs-3 control-label">每组次数</label>
          <div class="pull-left col-xs-7">
            <input type="text" name="movementNumber" value="${courseware.movementNumber eq 0 ? '' : courseware.movementNumber}" class="form-control" placeholder="请输入每组次数" data-validate="number">
          </div>
        </div>
        <c:if test="${!courseware.daily.batch.courseRound.fitnessGroup.type.online}">
          <div class="form-group x-form-group">
            <label class="col-xs-3 control-label">最大重量</label>
            <div class="pull-left col-xs-7">
              <input type="text" name="maxWeight" value="${courseware.maxWeight}" class="form-control" placeholder="请输入最大重量">
            </div>
          </div>
        </c:if>
        <div class="form-group x-form-group">
          <label class="col-xs-3 control-label">${courseware.daily.batch.courseRound.fitnessGroup.type.online ? '每组时间（分钟）' : '计时'}</label>
          <div class="pull-left col-xs-7">
            <input type="text" name="time" value="${courseware.time}" class="form-control" placeholder="请输入${courseware.daily.batch.courseRound.fitnessGroup.type.online ? '每组时间' : '计时'}"<c:if test="${courseware.daily.batch.courseRound.fitnessGroup.type.online}"> data-validate="number"</c:if>>
          </div>
        </div>
      </div>

      <div class="modal-footer">
        <button type="submit" class="btn btn-success btn-shadow btn-shadow-success x-btn">确定</button>&nbsp;&nbsp;&nbsp;&nbsp;
        <button type="button" class="btn btn-default btn-shadow btn-shadow-default x-btn" data-dismiss="modal">取消</button>
      </div>
    </form>

  </div>

</div>

<script type="text/javascript">
  $(function() {
    
    $('.select2').select2({
        minimumResultsForSearch : 5,
        placeholder:'请选择动作',
        allowClear : true,
        width: '100%'
       });
  })
</script>